package com.shell.customer.base.service.impl;

import com.shell.bee.persistence.service.impl.PersistentServiceImpl;
import com.shell.customer.base.dao.CusAcctDao;
import com.shell.customer.base.service.CusAcctService;
import com.shell.customer.base.vo.CusAcctVo;
import com.shell.customer.po.CusAcct;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("pubCusAcctService")
public class CusAcctServiceImpl extends PersistentServiceImpl<CusAcct> implements CusAcctService {
	@Autowired
	private CusAcctDao cusAcctDao;

	public int saveAcctBatch(List<CusAcct> accts) {
		return this.cusAcctDao.saveAcctBatch(accts);
	}

	public List<CusAcct> selectByCusId(String cusId) {
		return this.cusAcctDao.selectAcctWithUse(cusId, null);
	}

	public CusAcct getPubCusAcct(String cusId, String acctState, String acctType) {
		CusAcct cusAcct = new CusAcct();
		cusAcct.setCusId(cusId);
		cusAcct.setAcctState(acctState);
		cusAcct.setAcctType(acctType);
		cusAcct = (CusAcct) selectOne(cusAcct);
		return cusAcct;
	}

	public CusAcct selectByAcctNo(String cusId, String acctNo) {
		CusAcct cusAcct = new CusAcct();
		cusAcct.setCusId(cusId);
		cusAcct.setAcctNo(acctNo);
		cusAcct.setAcctState("N");
		return (CusAcct) selectOne(cusAcct);
	}

	public List<CusAcctVo> selectEsignAcctAuthList(String custId) {
		return this.cusAcctDao.selectEsignAcctAuthList(custId);
	}

	public List<CusAcct> selectAcctWithUse(String cusId, String acctState) {
		return this.cusAcctDao.selectAcctWithUse(cusId, acctState);
	}
}